
    
#import "CouponAnalysisDetailPageViewController.h"
#import "TheLoginViewController.h"

@interface CouponAnalysisDetailPageViewController ()<MBProgressHUDDelegate,UIGestureRecognizerDelegate,UINavigationControllerDelegate,UITextFieldDelegate,UISearchBarDelegate,UIWebViewDelegate>
@property (strong, nonatomic) NSString *areaValue;
@property (strong, nonatomic) NSString*cityValue;
    
    
@end
    
@implementation CouponAnalysisDetailPageViewController
    
{
    
        UIWebView*webview;
        HAODEsingleton* commdity;

}
    

-(void)BackAction:(UIButton *)sender{
        
    [self.navigationController popViewControllerAnimated:YES];
        
        
        
}
- (void)viewDidDisappear:(BOOL)animated
    
{
        
    [super viewDidDisappear:animated];
        
        
        
    self.navigationController.delegate = nil;
        
}
-(void)viewWillAppear:(BOOL)animated{
        [super viewWillAppear:animated];
        
        [[self rdv_tabBarController] setTabBarHidden:YES];
        
            self.navigationController.navigationBar.barStyle = UIBaselineAdjustmentNone;
    UILabel *lineLabel=[[UILabel alloc] initWithFrame:CGRectMake(0, 43,ScreenWidth, 1)];
    [lineLabel setBackgroundColor:[UIColor colorWithRed:238.0/255.0 green:238.0/255.0 blue:238.0/255.0 alpha:1.0]];
    [self.navigationController.navigationBar addSubview:lineLabel];
        [self.navigationController.navigationBar setTintColor:[UIColor whiteColor]];
        [[UINavigationBar appearance] setBarTintColor:Color];
        
        UIImage* backImage = [UIImage imageNamed:@"back.png"];
        CGRect backframe = CGRectMake(0,0,23/2,41/2);
        UIButton* backButton= [[UIButton alloc] initWithFrame:backframe];
        [backButton setBackgroundImage:backImage forState:UIControlStateNormal];
        backButton.titleLabel.textAlignment=NSTextAlignmentLeft;
        [backButton addTarget:self action:@selector(BackAction:) forControlEvents:UIControlEventTouchUpInside];
        UIBarButtonItem* leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:backButton];
        self.navigationItem.leftBarButtonItem = leftBarButtonItem;
        self.navigationController.delegate = self;
        
        self.navigationController.interactivePopGestureRecognizer.delegate = self;
        
        
        self.navigationController.navigationBarHidden = NO;
        [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@""] forBarMetrics:UIBarMetricsDefault];
        self.navigationController.navigationBar.shadowImage =[[UIImage alloc] init];
        
        self.title = @"优惠券分析";
        [self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
                                                                         backColor,
                                                                         UITextAttributeTextColor,
                                                                         [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1],
                                                                         UITextAttributeTextShadowColor,
                                                                         [NSValue valueWithUIOffset:UIOffsetMake(0, 0)],
                                                                         UITextAttributeTextShadowOffset,
                                                                         [UIFont fontWithName:@"Helvetica Neue" size:tetlefot],
                                                                         UITextAttributeFont,nil]];
        
}
    
- (void)viewDidLoad
{
        
        [super viewDidLoad];
        
        
        NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
        NSString* Token = [user objectForKey:@"tokenId"];
               NSMutableDictionary *param = [NSMutableDictionary new];
        [param setValue:Token forKey:@"tokenId"];
   
       
        [HttpRequest requestData:@"UserCenter/CouponAnalysis/DetailPage" params:param success:^(BOOL isSuccess, SeverData *severDataDict) {
            if (isSuccess) {
                
                NSLog(@"33333333====%@",severDataDict.dataDict);
                if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==0) {
                    [Global hideProgressHUDInternal:self.view];
                    
                    
                    webview  = [[UIWebView   alloc]  initWithFrame:CGRectMake( 0,  64,  ScreenWidth ,  ScreenHeight-64)];
                    webview.scalesPageToFit = TRUE;
                    [webview   setUserInteractionEnabled: YES ];	 //是否支持交互
                    [webview   setDelegate: self ];				 //委托
                    [webview   setOpaque: YES ];					 //透明
                    [self.view  addSubview : webview];
                    NSString * path =[NSString stringWithFormat:@"%@",[severDataDict.dataDict objectForKey:@"page"]];
                    
                    [webview loadRequest:[NSURLRequest requestWithURL:[[NSURL alloc] initWithString :path]]];
                    
                    
                    
                }else{
                    [Global hideProgressHUDInternal:self.view];
                    NSString *requestResultStr=[severDataDict.dataDict objectForKey:@"ResultString"];
                    // [Global showTextHud:requestResultStr view:self.view];
                    [Global showTextHudSub:requestResultStr view:self.view];
                    
                    
                    if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==9999) {
                        
                        NSString *requestResultStr=[severDataDict.dataDict objectForKey:@"ResultString"];
                        [Global showTextHud:requestResultStr view:self.view];
                        
                        
                        TheLoginViewController * second =
                        [[TheLoginViewController alloc]
                         initWithNibName:@"TheLoginViewController"
                         bundle:nil];
                        //        second.textt =self.text.text;
                        //        //    second.label.text = @"正向";
                        [self presentViewController:second animated:YES completion:nil];
                        
                    }
                }
            }
            else
            {
                [Global hideProgressHUDInternal:self.view];
                
                [Global showTextHudSub:@"连接失败" view:self.view];
            }
            
        }];
        
}
- (void)didReceiveMemoryWarning {
        [super didReceiveMemoryWarning];
        // Dispose of any resources that can be recreated.
}
    
    /*
     #pragma mark - Navigation
     
     // In a storyboard-based application, you will often want to do a little preparation before navigation
     - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
     // Get the new view controller using [segue destinationViewController].
     // Pass the selected object to the new view controller.
     }
     */
    
    @end

